#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 1e5+1;
const int M = 20;

int T,n,k;
LL num,x;
LL stmax[N][M],stmin[N][M];

inline LL getS(int l,int r){
    if(l==r) return 0;
    int k = (int)log2(r-l);
    return max(stmax[l][k],stmax[r-(1<<k)+1][k])- min(stmin[l][k],stmin[r-(1<<k)+1][k]);
}

inline bool solve(int mid){
    LL res0;
    int cnt=0;
    for(int i=1;;i++){
        if(i+mid-1>n) break;
        res0 = getS(i,i+mid-1);
        if(res0>=x) cnt++;
        if(cnt>=k) return true;
    }
    return false;
}

int main(){
    scanf("%d",&T);
    for(int i=0;i<T;i++){
        scanf("%d%d",&n,&k);
        for(int i=1;i<=n;i++){
            scanf("%lld",&num);
            stmax[i][0] = stmin[i][0] = num;
        }
        if(n==k){
            printf("0 1\n");
            continue;
        }
        for(int len=1;len<=(int)log2(n);len++){
            for(int j=1;j<=n;j++){
                stmax[j][len] = max(stmax[j][len-1],stmax[min(n,j+(1<<(len-1)))][len-1]);
                stmin[j][len] = min(stmin[j][len-1],stmin[min(n,j+(1<<(len-1)))][len-1]);
            }
        }

        int len0=n-k+1;
        x = LLONG_MAX;
        for(int i=1;;i++){
            if(i+len0-1>n) break;
            x = min(x,getS(i,i+len0-1));
        }
        printf("%lld ",x);

        int l=1,r=len0,mid;
        bool res1;
        while(l<r){
            mid = (r-l)/2+l;
            res1 = solve(mid);
            if(res1) r=mid;
            else l=mid+1;
        }
        printf("%d\n",l);
    }
    return 0;
}